var t = require;
var e = module;
var o = exports;
var a,
    i =
        (this && this.__extends) ||
        ((a = function (t, e) {
            return (a =
                Object.setPrototypeOf ||
                ({__proto__: []} instanceof Array &&
                    function (t, e) {
                        t.__proto__ = e;
                    }) ||
                function (t, e) {
                    for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
                })(t, e);
        }),
        function (t, e) {
            a(t, e);
            function o() {
                this.constructor = t;
            }
            t.prototype = null === e ? Object.create(e) : ((o.prototype = e.prototype), new o());
        }),
    n =
        (this && this.__decorate) ||
        function (t, e, o, a) {
            var i,
                n = arguments.length,
                r = n < 3 ? e : null === a ? (a = Object.getOwnPropertyDescriptor(e, o)) : a;
            if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(t, e, o, a);
            else
                for (var s = t.length - 1; s >= 0; s--)
                    (i = t[s]) && (r = (n < 3 ? i(r) : n > 3 ? i(e, o, r) : i(e, o)) || r);
            return n > 3 && r && Object.defineProperty(e, o, r), r;
        };
Object.defineProperty(o, "__esModule", {value: !0});
var r = t("UIBase"),
    s = cc._decorator,
    c = s.ccclass,
    p =
        (s.property,
        s.menu,
        (function (t) {
            i(e, t);
            function e() {
                return (null !== t && t.apply(this, arguments)) || this;
            }
            e.prototype.onShowEnd = function () {
                var t = this.ui_data;
                t.pos && this._lab.setPosition(t.pos);
                switch (t.mode) {
                    case "dlg":
                        break;
                    case "tip":
                        this.toTipMode(t);
                        break;
                    default:
                        this.toBaseData(t);
                }
            };
            e.prototype.toDlgMode = function () {};
            e.prototype.toTipMode = function (t) {
                var e = this,
                    o = "";
                t && t.msg && (o = "" + t.msg);
                if ("" != o) {
                    var a = 0,
                        i = t.labSpeeds || 0.05;
                    this.clickCallback = function () {
                        a = o.length;
                        e.setRichText(o.substring(0, a));
                    };
                    var n = function () {
                        if (a < o.length) {
                            a++;
                            e.setRichText(o.substring(0, a));
                            e.scheduleOnce(function () {
                                n();
                            }, i);
                        } else
                            e.scheduleOnce(function () {
                                e.fadeOutColse();
                            }, 0.2);
                    };
                    n();
                }
            };
            e.prototype.setRichText = function (t) {
                this._lab.$Label.string = t;
            };
            e.prototype._onBtnClickTouchEnd = function () {
                this.clickCallback && this.clickCallback();
            };
            e.prototype.toBaseData = function (t) {
                var e = this,
                    o = "";
                t && t.msg && (o = "" + t.msg);
                this.setRichText(o);
                this._lab.opacity = 0;
                this._lab.runAction(
                    cc.sequence([
                        cc.fadeIn(0.2),
                        cc.delayTime(2),
                        cc.callFunc(function () {
                            e.fadeOutColse();
                        }, this)
                    ])
                );
            };
            e.prototype.fadeOutColse = function (t) {
                var e = this;
                void 0 === t && (t = 0.2);
                var o = this.ui_data;
                cc.isValid(this._lab) &&
                    cc
                        .tween(this._lab)
                        .to(t, {opacity: 0})
                        .call(function () {
                            o.closeCb && o.closeCb();
                            e.closeUI();
                        })
                        .start();
            };
            return n([c], e);
        })(r.default));
o.default = p;
